package at.fhooe.tuxgestures.app;

import java.io.File;

import at.fhooe.tuxgestures.cam.CameraController;
import at.fhooe.tuxgestures.cam.ICameraController;
import at.fhooe.tuxgestures.keysimulator.IKeySimulator;
import at.fhooe.tuxgestures.keysimulator.KeySimulator;

public class TuxGestures
{
	// if we read test data from file
	private static boolean READ_FROM_FILE = false;
	private static String DATA_FILE_PATH = "C:/Users/Peter Piltich/Google Drive/Hagenberg_MC/02_SS_2013/MC_519 Sensors and Networks/P_2/HandsUpDown_RightLeft_GoodData.tof";
	
	// add connection info for camera here once needed...
	
	private void startTuxing()
	{
		ICameraController controller = null;
		// create the CameraController
		if (READ_FROM_FILE)
		{
			controller = new CameraController(
				new File(DATA_FILE_PATH));
		}
		else
		{
			controller = new CameraController();
		}
		
		// create the KeySimulator
		IKeySimulator keySimulator = new KeySimulator();
		// register the KeySimulator to listen to state changes
		controller.addCameraEventListener(keySimulator);
		
		// start the controller, that will start reading data
		// and sending events
		controller.start();
	}
	
	
	public static void main(String[] args)
	{
		if (args.length == 1)
		{
			DATA_FILE_PATH = args[0];
			READ_FROM_FILE = true;
		}
		
		TuxGestures tuxGestures = new TuxGestures();
		tuxGestures.startTuxing();
		
	}
	
}
